using System;
using ScrumManagementTool.db;
using ScrumManagementTool.db.interfaces;
using ScrumManagementTool.login.interfaces;

namespace ScrumManagementTool.login
{
    public class Registration : IRegistration
    {
        private IDbRegistration dbRegistration;

        public Registration():this(new DbRegistration())
        {
            
        }

        public Registration(IDbRegistration dbRegistration)
        {
            this.dbRegistration = dbRegistration;
        }

        public bool CheckUsernameAvailability(string username)
        {
            bool isAvailable = dbRegistration.CheckUsernameAvailability(username);
            Console.Out.WriteLine("is selected username available: " + isAvailable);
            return isAvailable;
        }

        public void AddUser(string username, string password, string contactNo, string name, string email)
        {
            dbRegistration.AddUser(username, password, contactNo, name, email);
        }
    }
}